How The Matching Algorithm Works